package com.easy.user.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.easy.common.bean.SysMenu;
import com.easy.common.bean.SysUser;
import com.easy.common.service.IMenuService;
import com.easy.user.mapper.*;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MenuService extends ServiceImpl<MenuMapper,SysMenu> implements IMenuService {
    @Override
    public SysMenu insert(SysMenu menu) {
        save(menu);
        int id=menu.getId();
        SysMenu result=super.getById(id);
        return result;
    }

    @Override
    public SysMenu update(SysMenu menu) {
        return null;
    }

    @Override
    public int delete(Integer id) {
        return 0;
    }

    @Override
    public SysMenu getByID(Integer id) {
        return null;
    }

    @Override
    public IPage<SysMenu> getListByPage(IPage page, SysMenu menu) {
        return null;
    }

    @Override
    public List<SysMenu> getList(SysMenu menu) {
        return null;
    }

    @Override
    public int setVisible(Integer id) {
        return 0;
    }

    public List<SysMenu> getListByUser(SysUser user){
        List<SysMenu> menus=this.getBaseMapper().getListByUser(user.getId());
        user.setMenus(menus);
        return menus;
    }
}
